#ifndef CONSTSTRING_H
#define CONSTSTRING_H

#include <QString>

const char* crc4_itu_string =
"static uint8_t crc4ITU_table[256] = {};\n"
"void crc4_itu_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;               // Initial value\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0x0C;        // 0x0C = (reverse 0x03)>>(8-4)\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc4ITU_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc4_itu_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;\n"
"        crc = crc4ITU_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";

const char* crc5_epu_string =
"static uint8_t crc5EPU_table[256] = {};\n"
"/* crc5_epu_GenerateTable */\n"
"void crc5_epu_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;    // Initial value\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x80)\n"
"                crc = (crc << 1) ^ 0x48;        // 0x0C = (reverse 0x03)>>(8-4)\n"
"            else\n"
"                crc = (crc << 1);\n"
"        }\n"
"        crc5EPU_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc5_epc_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t crc = 0x48;\n"
"    uint8_t tmp = 0;\n"
"    while(length--){\n"
"        tmp = crc ^ (*data++);\n"
"        crc = crc5EPU_table[tmp];\n"
"    }\n"
"    return crc>>3;\n"
"}\n";
const char* crc5_itu_string =
"static uint8_t crc5ITU_table[256] = {};\n"
"void crc5_itu_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;         // Initial value\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0x15;        // 0x0C = (reverse 0x03)>>(8-4)\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc5ITU_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc5_itu_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;\n"
"        crc = crc5ITU_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";

const char* crc5_usb_string =
"static uint8_t crc5USB_table[256] = {};\n"
"void crc5_usb_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;         // Initial value\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;\n"
"        for (uint16_t j = 0; j < 8; ++j\n){"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0x14;// 0x14 = (reverse 0x05)>>(8-5)\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc5USB_table[i] = crc;\n"
"    }\n"
"}\n"
"/* CRC5_usb_calc */\n"
"uint8_t crc5_usb_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t crc = 0x1F;\n"
"    uint8_t tmp = 0;\n"
"    while(length--){\n"
"        tmp = crc ^ *data++;\n"
"        crc = crc5USB_table[tmp];\n"
"    }\n"
"    return crc^0x1F;\n"
"}\n";
const char* crc6_itu_string =
"static uint8_t crc6ITU_table[256] = {};\n"
"void crc6_itu_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;         // Initial value\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0x30;// 0x30 = (reverse 0x03)>>(8-6)\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc6ITU_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc6_itu_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;\n"
"        crc = crc6ITU_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";

const char* crc7_mmc_string =
"static uint8_t crc7MMC_table[256] = {};\n"
"void crc7_mmc_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;               // Initial value\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x80)\n"
"                crc = (crc << 1) ^ 0x12;        // 0x12 = 0x09<<(8-7)\n"
"            else\n"
"                crc = (crc << 1);\n"
"        }\n"
"        crc7MMC_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc7_mmc_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;\n"
"        crc = crc7MMC_table[tmp];\n"
"    }\n"
"    return crc >> 1;\n"
"}\n";

const char* crc8_string =
"static uint8_t crc8_table[256] = {};\n"
"/* crc8_GenerateTable */\n"
"void crc8_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;        // Initial value\n"
"    for(uint16_t i =0; i<256; i++){\n"
"        crc = i;\n"
"        for(uint16_t j=0; j<8; j++ ){\n"
"            if( crc & 0x80 ){\n"
"                crc = (crc << 1) ^ 0x07;\n"
"            }\n"
"            else{\n"
"                 crc = (crc << 1) ;\n"
"            }\n"
"        }\n"
"        crc8_table[i] = crc;\n"
"    }\n"
"}\n"
"/* CRC8_calc */\n"
"uint8_t crc8_calc(uint8_t *data, uint32_t length){\n"
"    uint8_t crc = 0;\n"
"    uint8_t tmp = 0;\n"
"    while(length--){\n"
"        tmp = crc ^ *data++;\n"
"        crc = crc8_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";
const char* crc8_itu_string =
"uint8_t crc8_itu_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;      // crc ^= *data; data++;\n"
"        crc = crc8_table[tmp];    // 与crc8_table表格一致\n"
"    }\n"
"    return crc^0x55;\n"
"}\n";


const char* crc8_rohc_string =
"static uint8_t crc8ROHC_table[256] = {};\n"
"void crc8_rohc_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;         // Initial value\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0xE0;        // 0xE0 = reverse 0x07\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc8ROHC_table[i] = crc;\n"
"    }\n"
"}\n"
"/* CRC8_calc */\n"
"uint8_t crc8_rohc_Calc(uint8_t *data, uint32_t length){\n"
"    uint8_t crc = 0xFF;\n"
"    uint8_t tmp = 0;\n"
"    while(length--){\n"
"        tmp = crc ^ *data++;\n"
"        crc = crc8ROHC_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";

const char* crc8_maxim_string =
"static uint8_t crc8MAXIM_table[256] = {};\n"
"void crc8_maxim_GenerateTable()\n"
"{\n"
"    uint8_t crc = 0;         // Initial value\n"
"    for(uint16_t i=0; i<256; i++){\n"
"        crc = i;\n"
"        for (uint16_t j = 0; j < 8; ++j){\n"
"            if (crc & 0x01)\n"
"                crc = (crc >> 1) ^ 0x8C;        // 0x8C = reverse 0x31\n"
"            else\n"
"                crc = (crc >> 1);\n"
"        }\n"
"        crc8MAXIM_table[i] = crc;\n"
"    }\n"
"}\n"
"uint8_t crc8_maxim_calc(uint8_t *data, uint32_t length)\n"
"{\n"
"    uint8_t tmp = 0;\n"
"    uint8_t crc = 0;                // Initial value\n"
"    while(length--)\n"
"    {\n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;\n"
"        crc = crc8MAXIM_table[tmp];\n"
"    }\n"
"    return crc;\n"
"}\n";

const char* crc8_cdma2000_string =
"static uint8_t crc8CDMA2000_table[256] = {};                \n"
"/* crc8_GenerateTable */                                    \n"
"void crc8_cdma2000_GenerateTable()                          \n"
"{                                                           \n"
"    uint8_t crc = 0;        // Initial value                \n"
"    for(uint16_t i =0; i<256; i++){                         \n"
"        crc = i;                                            \n"
"        for(uint16_t j=0; j<8; j++ ){                       \n"
"            if( crc & 0x80 ){                               \n"
"                crc = (crc << 1) ^ 0x9B;                    \n"
"            }                                               \n"
"            else{                                           \n"
"                 crc = (crc << 1) ;                         \n"
"            }                                               \n"
"        }                                                   \n"
"        crc8CDMA2000_table[i] = crc;                        \n"
"    }                                                       \n"
"}                                                           \n"
"/* crc8_cdma2000_Calc */                                    \n"
"uint8_t crc8_cdma2000_calc(uint8_t *data, uint32_t length){ \n"
"    uint8_t crc = 0xFF;                                     \n"
"    uint8_t tmp = 0;                                        \n"
"    while(length--){                                        \n"
"        tmp = crc ^ *data++;                                \n"
"        crc = crc8CDMA2000_table[tmp];                      \n"
"    }                                                       \n"
"    return crc;                                             \n"
"}                                                           \n";
const char* crc8_darc_string =
"static uint8_t crc8DARC_table[256] = {};                                       \n"
"void crc8_darc_GenerateTable()                                                 \n"
"{                                                                              \n"
"    uint8_t crc = 0;         // Initial value                                  \n"
"    for(uint16_t i=0; i<256; i++){                                             \n"
"        crc = i;                                                               \n"
"        for (uint16_t j = 0; j < 8; ++j){                                      \n"
"            if (crc & 0x01)                                                    \n"
"                crc = (crc >> 1) ^ 0x9C;        // 0x9C = reverse 0x39         \n"
"            else                                                               \n"
"                crc = (crc >> 1);                                              \n"
"        }                                                                      \n"
"        crc8DARC_table[i] = crc;                                               \n"
"    }                                                                          \n"
"}                                                                              \n"
"                                                                               \n"
"uint8_t crc8_darc_calc(uint8_t *data, uint32_t length)                         \n"
"{                                                                              \n"
"    uint8_t tmp = 0;                                                           \n"
"    uint8_t crc = 0;                // Initial value                           \n"
"    while(length--)                                                            \n"
"    {                                                                          \n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;          \n"
"        crc = crc8DARC_table[tmp];                                             \n"
"    }                                                                          \n"
"    return crc;                                                                \n"
"}                                                                              \n";

const char* crc8_dvb_s2_string =
"static uint8_t crc8DVB_S2_table[256] = {};                  \n"
"                                                            \n"
"/* crc8_GenerateTable */                                    \n"
"void crc8_dvb_s2_GenerateTable()                            \n"
"{                                                           \n"
"    uint8_t crc = 0;        // Initial value                \n"
"    for(uint16_t i =0; i<256; i++){                         \n"
"        crc = i;                                            \n"
"        for(uint16_t j=0; j<8; j++ ){                       \n"
"            if( crc & 0x80 ){                               \n"
"                crc = (crc << 1) ^ 0xD5;                    \n"
"            }                                               \n"
"            else{                                           \n"
"                 crc = (crc << 1) ;                         \n"
"            }                                               \n"
"        }                                                   \n"
"        crc8DVB_S2_table[i] = crc;                          \n"
"    }                                                       \n"
"}                                                           \n"
"/* crc8_dvb_s2_calc */                                      \n"
"uint8_t crc8_dvb_s2_calc(uint8_t *data, uint32_t length){   \n"
"    uint8_t crc = 0;                                        \n"
"    uint8_t tmp = 0;                                        \n"
"    while(length--){                                        \n"
"        tmp = crc ^ *data++;                                \n"
"        crc = crc8DVB_S2_table[tmp];                        \n"
"    }                                                       \n"
"    return crc;                                             \n"
"}                                                           \n";

const char* crc8_ebu_string =
"static uint8_t crc8EBU_table[256] = {};                                \n"
"void crc8_ebu_GenerateTable()                                          \n"
"{                                                                      \n"
"    uint8_t crc = 0;         // Initial value                          \n"
"    for(uint16_t i=0; i<256; i++){                                     \n"
"        crc = i;                                                       \n"
"        for (uint16_t j = 0; j < 8; ++j){                              \n"
"            if (crc & 0x01)                                            \n"
"                crc = (crc >> 1) ^ 0xB8;        // 0xB8 = reverse 0x1D \n"
"            else                                                       \n"
"                crc = (crc >> 1);                                      \n"
"        }                                                              \n"
"        crc8EBU_table[i] = crc;                                        \n"
"    }                                                                  \n"
"}                                                                      \n"
"                                                                       \n"
"uint8_t crc8_ebu_calc(uint8_t *data, uint32_t length)                  \n"
"{                                                                      \n"
"    uint8_t tmp = 0;                                                   \n"
"    uint8_t crc = 0xFF;                // Initial value                \n"
"    while(length--)                                                    \n"
"    {                                                                  \n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;  \n"
"        crc = crc8EBU_table[tmp];                                      \n"
"    }                                                                  \n"
"    return crc;                                                        \n"
"}                                                                      \n";
const char* crc8_i_code_string =
"static uint8_t crc8I_CODE_table[256] = {};                            \n"
"                                                                      \n"
"/* crc8_GenerateTable */                                              \n"
"void crc8_i_code_GenerateTable()                                      \n"
"{                                                                     \n"
"    uint8_t crc = 0;        // Initial value                          \n"
"    for(uint16_t i =0; i<256; i++){                                   \n"
"        crc = i;                                                      \n"
"        for(uint16_t j=0; j<8; j++ ){                                 \n"
"            if( crc & 0x80 ){                                         \n"
"                crc = (crc << 1) ^ 0x1D;                              \n"
"            }                                                         \n"
"            else{                                                     \n"
"                 crc = (crc << 1) ;                                   \n"
"            }                                                         \n"
"        }                                                             \n"
"        crc8I_CODE_table[i] = crc;                                    \n"
"    }                                                                 \n"
"}                                                                     \n"
"/* crc8_i_code_calc */                                                \n"
"uint8_t crc8_i_code_calc(uint8_t *data, uint32_t length){             \n"
"    uint8_t crc = 0xFD;                                               \n"
"    uint8_t tmp = 0;                                                  \n"
"    while(length--){                                                  \n"
"        tmp = crc ^ *data++;                                          \n"
"        crc = crc8I_CODE_table[tmp];                                  \n"
"    }                                                                 \n"
"    return crc;                                                       \n"
"}                                                                     \n";
const char* crc8_wcdma_string =
"static uint8_t crc8WCDMA_table[256] = {};                                  \n"
"void crc8_wcdma_GenerateTable()                                            \n"
"{                                                                          \n"
"    uint8_t crc = 0;         // Initial value                              \n"
"    for(uint16_t i=0; i<256; i++){                                         \n"
"        crc = i;                                                           \n"
"        for (uint16_t j = 0; j < 8; ++j){                                  \n"
"            if (crc & 0x01)                                                \n"
"                crc = (crc >> 1) ^ 0xD9;        // 0xD9 = reverse 0x9B     \n"
"            else                                                           \n"
"                crc = (crc >> 1);                                          \n"
"        }                                                                  \n"
"        crc8WCDMA_table[i] = crc;                                          \n"
"    }                                                                      \n"
"}                                                                          \n"
"                                                                           \n"
"uint8_t crc8_wcdma_calc(uint8_t *data, uint32_t length)                    \n"
"{                                                                          \n"
"    uint8_t tmp = 0;                                                       \n"
"    uint8_t crc = 0;                // Initial value                       \n"
"    while(length--)                                                        \n"
"    {                                                                      \n"
"        tmp = crc ^ *data++;                 // crc ^= *data; data++;      \n"
"        crc = crc8WCDMA_table[tmp];                                        \n"
"    }                                                                      \n"
"    return crc;                                                            \n"
"}                                                                          \n";


const char* crc16_ibm_string =

"static uint16_t crc16IBM_table[256] = {};                                         \n"
"void crc16_ibm_GenerateTable()                                                    \n"
"{                                                                                 \n"
"    uint16_t crc = 0;                                                             \n"
"    for(uint16_t i=0; i<256; i++){                                                \n"
"        crc = i;               // Initial value                                   \n"
"        for (uint16_t j = 0; j < 8; ++j){                                         \n"
"            if (crc & 0x01)                                                       \n"
"                crc = (crc >> 1) ^ 0xA001;        // 0xA001 = reverse 0x8005      \n"
"            else                                                                  \n"
"                crc = (crc >> 1);                                                 \n"
"        }                                                                         \n"
"        crc16IBM_table[i] = crc;                                                  \n"
"    }                                                                             \n"
"}                                                                                 \n"
"                                                                                  \n"
"uint16_t crc16_ibm_calc(uint8_t *data, uint32_t length)                           \n"
"{                                                                                 \n"
"    uint16_t tmp = 0;                                                             \n"
"    uint16_t crc = 0;                // Initial value                             \n"
"    while(length--)                                                               \n"
"    {                                                                             \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;            \n"
"        crc = (crc >> 8) ^ crc16IBM_table[tmp&0xFF];                              \n"
"    }                                                                             \n"
"    return crc;                                                                   \n"
"}                                                                                 \n";

const char* crc16_maxim_string =
"uint16_t crc16_maxim_calc(uint8_t *data, uint32_t length)                  \n"
"{                                                                          \n"
"    uint16_t tmp = 0;                                                      \n"
"    uint16_t crc = 0;                // Initial value                      \n"
"    while(length--)                                                        \n"
"    {                                                                      \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;     \n"
"        crc = (crc >> 8) ^ crc16IBM_table[tmp&0xFF];                       \n"
"    }                                                                      \n"
"    return ~crc; // crc ^ 0xFFFF                                           \n"
"}                                                                          \n";

const char* crc16_usb_string =

"uint16_t crc16_usb_calc(uint8_t *data, uint32_t length)                 \n"
"{                                                                       \n"
"    uint16_t tmp = 0;                                                   \n"
"    uint16_t crc = 0xFFFF;                // Initial value              \n"
"    while(length--)                                                     \n"
"    {                                                                   \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;  \n"
"        crc = (crc >> 8) ^ crc16IBM_table[tmp&0xFF];                    \n"
"    }                                                                   \n"
"    return ~crc; // crc ^ 0xFFFF                                        \n"
"}                                                                       \n";

const char* crc16_modbus_string =
"uint16_t crc16_modbus_calc(uint8_t *data, uint32_t length)               \n"
"{                                                                        \n"
"    uint16_t tmp = 0;                                                    \n"
"    uint16_t crc = 0xFFFF;                // Initial value               \n"
"    while(length--)                                                      \n"
"    {                                                                    \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;   \n"
"        crc = (crc >> 8) ^ crc16IBM_table[tmp&0xFF];                     \n"
"    }                                                                    \n"
"    return crc; // crc                                                   \n"
"}                                                                        \n";

const char* crc16_ccitt_string =
"static uint16_t crc16CCITT_table[256] = {};                                     \n"
"void crc16_ccitt_GenerateTable()                                                \n"
"{                                                                               \n"
"    uint16_t crc = 0;                                                           \n"
"    for(uint16_t i=0; i<256; i++){                                              \n"
"        crc = i;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                       \n"
"            if (crc & 0x01)                                                     \n"
"                crc = (crc >> 1) ^ 0x8408;        // 0x8408 = reverse 0x1021    \n"
"            else                                                                \n"
"                crc = (crc >> 1);                                               \n"
"        }                                                                       \n"
"        crc16CCITT_table[i] = crc;                                              \n"
"    }                                                                           \n"
"}                                                                               \n"
"uint16_t crc16_ccitt_calc(uint8_t *data, uint32_t length)                       \n"
"{                                                                               \n"
"    uint16_t tmp = 0;                                                           \n"
"    uint16_t crc = 0;                // Initial value                           \n"
"    while(length--)                                                             \n"
"    {                                                                           \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;          \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                          \n"
"    }                                                                           \n"
"    return crc; // crc                                                          \n"
"}                                                                               \n";

const char* crc16_ccitt_false_string =
"static uint16_t crc16CCITT_false_table[256] = {};                          \n"
"void crc16_ccitt_false_GenerateTable()                                     \n"
"{                                                                          \n"
"    uint16_t crc = 0;                                                      \n"
"    for(uint16_t i=0; i<256; i++){                                         \n"
"        crc = i<<8;               // Initial value                         \n"
"        for (uint16_t j = 0; j < 8; ++j){                                  \n"
"            if (crc & 0x8000)                                              \n"
"                crc = (crc << 1) ^ 0x1021;                                 \n"
"            else                                                           \n"
"                crc = (crc << 1);                                          \n"
"        }                                                                  \n"
"        crc16CCITT_false_table[i] = crc;                                   \n"
"    }                                                                      \n"
"}                                                                          \n"
"uint16_t crc16_ccitt_false_calc(uint8_t *data, uint32_t length)            \n"
"{                                                                          \n"
"    uint16_t tmp = 0;                                                      \n"
"    uint16_t crc = 0xFFFF;                // Initial value                 \n"
"    while(length--)                                                        \n"
"    {                                                                      \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;          \n"
"        crc = (crc << 8) ^ crc16CCITT_false_table[tmp&0xFF];               \n"
"    }                                                                      \n"
"    return crc; // crc                                                     \n"
"}                                                                          \n";

const char* crc16_x25_string =
"uint16_t crc16_x25_calc(uint8_t *data, uint32_t length)                   \n"
"{                                                                         \n"
"    uint16_t tmp = 0;                                                     \n"
"    uint16_t crc = 0xFFFF;                // Initial value                \n"
"    while(length--)                                                       \n"
"    {                                                                     \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;    \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                    \n"
"    }                                                                     \n"
"    return ~crc; // crc ^ 0xFFFF                                          \n"
"}\n";

const char* crc16_xmodem_string =
"uint16_t crc16_xmodem_calc(uint8_t *data, uint32_t length)                         \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16CCITT_false_table[tmp&0xFF];                       \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";

const char* crc16_dnp_string =
"static uint16_t crc16DNP_table[256] = {                                             \n"
"};                                                                                  \n"
"                                                                                    \n"
"void crc16_DNP_GenerateTable()                                                      \n"
"{                                                                                   \n"
"    uint16_t crc = 0;                                                               \n"
"    for(uint16_t i=0; i<256; i++){                                                  \n"
"        crc = i;               // Initial value                                     \n"
"        for (uint16_t j = 0; j < 8; ++j){                                           \n"
"            if (crc & 0x01)                                                         \n"
"                crc = (crc >> 1) ^ 0xA6BC;        // 0xA6BC = reverse 0x3D65        \n"
"            else                                                                    \n"
"                crc = (crc >> 1);                                                   \n"
"        }                                                                           \n"
"        crc16DNP_table[i] = crc;                                                    \n"
"    }                                                                               \n"
"}                                                                                   \n"
"uint16_t crc16_dnp_calc(uint8_t *data, uint32_t length)                             \n"
"{                                                                                   \n"
"    uint16_t tmp = 0;                                                               \n"
"    uint16_t crc = 0;                // Initial value                               \n"
"    while(length--)                                                                 \n"
"    {                                                                               \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;              \n"
"        crc = (crc >> 8) ^ crc16DNP_table[tmp&0xFF];                                \n"
"    }                                                                               \n"
"    return ~crc; // crc ^ 0xFFFF                                                    \n"
"}                                                                                   \n";


const char* crc16_aug_ccitt_string =
"uint16_t crc16_aug_ccitt_calc(uint8_t *data, uint32_t length)                      \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0x1D0F;                // Initial value                         \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16CCITT_false_table[tmp&0xFF];                       \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";


const char* crc16_buypass_string =
"static uint16_t crc16BUTPASS_table[256] = {};                                      \n"
"void crc16_buypass_GenerateTable()                                                 \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0x8005;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16BUTPASS_table[i] = crc;                                               \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_buypass_calc(uint8_t *data, uint32_t length)                        \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16BUTPASS_table[tmp&0xFF];                           \n"
"    }                                                                              \n"
"    return crc;                                                                    \n"
"}                                                                                  \n";

const char* crc16_cdma2000_string =
"static uint16_t crc16CDMA2000_table[256] = {                                       \n"
"};                                                                                 \n"
"                                                                                   \n"
"/* crc16_ccitt_false_GenerateTable */                                              \n"
"void crc16_cdma2000_GenerateTable()                                                \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0xC867;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16CDMA2000_table[i] = crc;                                              \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_cdma2000_calc(uint8_t *data, uint32_t length)                       \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0xFFFF;                // Initial value                         \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16CDMA2000_table[tmp&0xFF];                          \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";

const char* crc16_dds_110_string =
"uint16_t crc16_dds_110_calc(uint8_t *data, uint32_t length)                        \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0x800D;                // Initial value                         \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16BUTPASS_table[tmp&0xFF];                           \n"
"    }                                                                              \n"
"    return crc;                                                                    \n"
"}                                                                                  \n";

const char* crc16_dect_r_string =
"static uint16_t crc16DECT_R_table[256] = {                                         \n"
"};                                                                                 \n"
"                                                                                   \n"
"/* crc16_ccitt_false_GenerateTable */                                              \n"
"void crc16_dect_r_GenerateTable()                                                  \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0x0589;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16DECT_R_table[i] = crc;                                                \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_dect_r_calc(uint8_t *data, uint32_t length)                         \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16DECT_R_table[tmp&0xFF];                            \n"
"    }                                                                              \n"
"    return crc ^ 0x0001; // crc                                                    \n"
"}                                                                                  \n";

const char* crc16_dect_x_string =
"uint16_t crc16_dect_x_calc(uint8_t *data, uint32_t length)                         \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16DECT_R_table[tmp&0xFF];                            \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";

const char* crc16_en_13757_string =
"static uint16_t crc16EN_13757_table[256] = {                                       \n"
"};                                                                                 \n"
"                                                                                   \n"
"/* crc16_ccitt_false_GenerateTable */                                              \n"
"void crc16_en_13757_GenerateTable()                                                \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0x3D65;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16EN_13757_table[i] = crc;                                              \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_en_13757_calc(uint8_t *data, uint32_t length)                       \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16EN_13757_table[tmp&0xFF];                          \n"
"    }                                                                              \n"
"    return ~crc; // crc ^ 0xFFFF                                                   \n"
"}                                                                                  \n";

const char* crc16_genibus_string =
"uint16_t crc16_genibus_calc(uint8_t *data, uint32_t length)                        \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0xFFFF;                // Initial value                         \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16CCITT_false_table[tmp&0xFF];                       \n"
"    }                                                                              \n"
"    return ~crc; // crc ^ 0xFFFF                                                   \n"
"}                                                                                  \n";

const char* crc16_mcrf4xx_string =
"uint16_t crc16_mcrf4xx_calc(uint8_t *data, uint32_t length)                        \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0xFFFF;                // Initial value                         \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;             \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                             \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";
const char* crc16_riello_string =

"uint16_t crc16_riello_calc(uint8_t *data, uint32_t length)                         \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0x554D;   // Initial value    // 0x554D = reverse 0xB2AA        \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;             \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                             \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";
const char* crc16_t10_dif_string =

"static uint16_t crc16T10_DIF_table[256] = {                                        \n"
"};                                                                                 \n"
"                                                                                   \n"
"                                                                                   \n"
"void crc16_t10_dif_GenerateTable()                                                 \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0x8BB7;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16T10_DIF_table[i] = crc;                                               \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_t10_dif_calc(uint8_t *data, uint32_t length)                        \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16T10_DIF_table[tmp&0xFF];                           \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";
const char* crc16_teledisk_string =

"static uint16_t crc16TELEDISK_table[256] = {                                       \n"
"};                                                                                 \n"
"                                                                                   \n"
"                                                                                   \n"
"void crc16_teledisk_GenerateTable()                                                \n"
"{                                                                                  \n"
"    uint16_t crc = 0;                                                              \n"
"    for(uint16_t i=0; i<256; i++){                                                 \n"
"        crc = i<<8;               // Initial value                                 \n"
"        for (uint16_t j = 0; j < 8; ++j){                                          \n"
"            if (crc & 0x8000)                                                      \n"
"                crc = (crc << 1) ^ 0xA097;                                         \n"
"            else                                                                   \n"
"                crc = (crc << 1);                                                  \n"
"        }                                                                          \n"
"        crc16TELEDISK_table[i] = crc;                                              \n"
"    }                                                                              \n"
"}                                                                                  \n"
"                                                                                   \n"
"uint16_t crc16_teledisk_calc(uint8_t *data, uint32_t length)                       \n"
"{                                                                                  \n"
"    uint16_t tmp = 0;                                                              \n"
"    uint16_t crc = 0;                // Initial value                              \n"
"    while(length--)                                                                \n"
"    {                                                                              \n"
"        tmp = (crc >> 8) ^ (*data++);    // crc ^= *data; data++;                  \n"
"        crc = (crc << 8) ^ crc16TELEDISK_table[tmp&0xFF];                          \n"
"    }                                                                              \n"
"    return crc; // crc                                                             \n"
"}                                                                                  \n";
const char* crc16_tms37157_string =

"uint16_t crc16_tms37157_calc(uint8_t *data, uint32_t length)                      \n"
"{                                                                                 \n"
"    uint16_t tmp = 0;                                                             \n"
"    uint16_t crc = 0x3791;    // Initial value    // 0x3791 = reverse 0x89EC      \n"
"    while(length--)                                                               \n"
"    {                                                                             \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;            \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                            \n"
"    }                                                                             \n"
"    return crc; // crc                                                            \n"
"}                                                                                 \n";
const char* crc16_a_string =

"uint16_t crc16_a_calc(uint8_t *data, uint32_t length)                             \n"
"{                                                                                 \n"
"    uint16_t tmp = 0;                                                             \n"
"    uint16_t crc = 0x6363;    // Initial value    // 0x6363 = reverse 0xC6C6             \n"
"    while(length--)                                                                      \n"
"    {                                                                                    \n"
"        tmp =  (0x00FF & crc) ^ (*data++);    // crc ^= *data; data++;                   \n"
"        crc = (crc >> 8) ^ crc16CCITT_table[tmp&0xFF];                                   \n"
"    }                                                                                    \n"
"    return crc; // crc                                                                   \n"
"}                                                                                        \n";
const char* crc32_string =

"static uint32_t crc32_table[256] = {};                                                         \n"
"                                                                                               \n"
"void crc32_GenerateTable()                                                                     \n"
"{                                                                                                     \n"
"    uint32_t crc = 0;                                                                                 \n"
"    for(uint16_t i=0; i<256; i++){                                                                    \n"
"        crc = i;               // Initial value                                                       \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                             \n"
"            if (crc & 0x01)                                                                           \n"
"                crc = (crc >> 1) ^ 0xEDB88320;// 0xEDB88320= reverse 0x04C11DB7                       \n"
"            else                                                                                      \n"
"                crc = (crc >> 1);                                                                     \n"
"        }                                                                                             \n"
"        crc32_table[i] = crc;                                                                         \n"
"    }                                                                                                 \n"
"}                                                                                                     \n"
"                                                                                                      \n"
"uint32_t crc32_calc(uint8_t *data, uint32_t length)                                                   \n"
"{                                                                                                     \n"
"    uint32_t tmp = 0;                                                                                 \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                        \n"
"    while(length--)                                                                                   \n"
"    {                                                                                                 \n"
"        tmp =  (0x000000FF & crc) ^ (*data++);    // crc ^= *data; data++;                            \n"
"        crc = (crc >> 8) ^ crc32_table[tmp&0xFF];                                                     \n"
"    }                                                                                                 \n"
"    return ~crc; // crc ^ 0xFFFFFFFF                                                                  \n"
"}                                                                                                     \n";
const char* crc32_mpeg_2_string =
"static uint32_t crc32MPEG_2_table[256] = {};                                                            \n"
"                                                                                                       \n"
"void crc32_mpeg_2_GenerateTable()                                                                      \n"
"{                                                                                                      \n"
"    uint32_t crc = 0;                                                                                  \n"
"    for(uint16_t i=0; i<256; i++){                                                                     \n"
"        crc = i<<24;               // Initial value                                                    \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                              \n"
"            if (crc & 0x80000000)                                                                      \n"
"                crc = (crc << 1) ^ 0x04C11DB7;                                                         \n"
"            else                                                                                       \n"
"                crc = (crc << 1);                                                                      \n"
"        }                                                                                              \n"
"        crc32MPEG_2_table[i] = crc;                                                                    \n"
"    }                                                                                                  \n"
"}                                                                                                      \n"
"                                                                                                       \n"
"uint32_t crc32_mpeg_2_calc(uint8_t *data, uint32_t length)                                             \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                         \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp = (crc >> 24) ^ (*data++);    // crc ^= *data; data++;                                     \n"
"        crc = (crc << 8) ^ crc32MPEG_2_table[tmp&0xFF];                                                \n"
"    }                                                                                                  \n"
"    return crc; // crc                                                                                 \n"
"}                                                                                                      \n";
const char* crc32_bzip2_string =

"uint32_t crc32_bzip2_calc(uint8_t *data, uint32_t length)                                              \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                         \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp = (crc >> 24) ^ (*data++);    // crc ^= *data; data++;                                     \n"
"        crc = (crc << 8) ^ crc32MPEG_2_table[tmp&0xFF];                                                \n"
"    }                                                                                                  \n"
"    return ~crc; // crc ^ 0xFFFFFFFF                                                                   \n"
"}                                                                                                      \n";
const char* crc32_posix_string =
"uint32_t crc32_posix_calc(uint8_t *data, uint32_t length)                                              \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0x0000000;                // Initial value                                          \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp = (crc >> 24) ^ (*data++);    // crc ^= *data; data++;                                     \n"
"        crc = (crc << 8) ^ crc32MPEG_2_table[tmp&0xFF];                                                \n"
"    }                                                                                                  \n"
"    return ~crc; // crc ^ 0xFFFFFFFF                                                                   \n"
"}                                                                                                      \n";
const char* crc32_jamcrc_string =
"uint32_t crc32_jamcrc_calc(uint8_t *data, uint32_t length)                                             \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                         \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp =  (0x000000FF & crc) ^ (*data++);    // crc ^= *data; data++;                             \n"
"        crc = (crc >> 8) ^ crc32_table[tmp&0xFF];                                                      \n"
"    }                                                                                                  \n"
"    return crc; // crc                                                                                 \n"
"}                                                                                                      \n";
const char* crc32_xfer_string =
"static uint32_t crc32XFER_table[256] = {};                                                             \n"
"                                                                                                       \n"
"void crc32_xfer_GenerateTable()                                                                        \n"
"{                                                                                                      \n"
"    uint32_t crc = 0;                                                                                  \n"
"    for(uint16_t i=0; i<256; i++){                                                                     \n"
"        crc = i<<24;               // Initial value                                                    \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                              \n"
"            if (crc & 0x80000000)                                                                      \n"
"                crc = (crc << 1) ^ 0x000000AF;                                                         \n"
"            else                                                                                       \n"
"                crc = (crc << 1);                                                                      \n"
"        }                                                                                              \n"
"        crc32XFER_table[i] = crc;                                                                      \n"
"    }                                                                                                  \n"
"}                                                                                                      \n"
"                                                                                                       \n"
"uint32_t crc32_xfer_calc(uint8_t *data, uint32_t length)                                               \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0;                // Initial value                                                  \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp = (crc >> 24) ^ (*data++);    // crc ^= *data; data++;                                     \n"
"        crc = (crc << 8) ^ crc32XFER_table[tmp&0xFF];                                                  \n"
"    }                                                                                                  \n"
"    return crc; // crc                                                                                 \n"
"}                                                                                                      \n";
const char* crc32_c_string =
"static uint32_t crc32C_table[256] = {};                                                                \n"
"                                                                                                       \n"
"void crc32_c_GenerateTable()                                                                           \n"
"{                                                                                                      \n"
"    uint32_t crc = 0;                                                                                  \n"
"    for(uint16_t i=0; i<256; i++){                                                                     \n"
"        crc = i;               // Initial value                                                        \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                              \n"
"            if (crc & 0x01)                                                                            \n"
"                crc = (crc >> 1) ^ 0x82F63B78;// 0x82F63B78 = reverse 0x1EDC6F41                       \n"
"            else                                                                                       \n"
"                crc = (crc >> 1);                                                                      \n"
"        }                                                                                              \n"
"        crc32C_table[i] = crc;                                                                         \n"
"    }                                                                                                  \n"
"}                                                                                                      \n"
"                                                                                                       \n"
"uint32_t crc32_c_calc(uint8_t *data, uint32_t length)                                                  \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                         \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp =  (0x000000FF & crc) ^ (*data++);    // crc ^= *data; data++;                             \n"
"        crc = (crc >> 8) ^ crc32C_table[tmp&0xFF];                                                     \n"
"    }                                                                                                  \n"
"    return ~crc; // crc ^ 0xFFFFFFFF                                                                   \n"
"}                                                                                                      \n";
const char* crc32_d_string =
"static uint32_t crc32D_table[256] = {};                                                                \n"
"void crc32_d_GenerateTable()                                                                           \n"
"{                                                                                                      \n"
"    uint32_t crc = 0;                                                                                  \n"
"    for(uint16_t i=0; i<256; i++){                                                                     \n"
"        crc = i;               // Initial value                                                        \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                              \n"
"            if (crc & 0x01)                                                                            \n"
"                crc = (crc >> 1) ^ 0xD419CC15;// 0x82F63B78 = reverse 0xA833982B                       \n"
"            else                                                                                       \n"
"                crc = (crc >> 1);                                                                      \n"
"        }                                                                                              \n"
"        crc32D_table[i] = crc;                                                                         \n"
"    }                                                                                                  \n"
"}                                                                                                      \n"
"                                                                                                       \n"
"uint32_t crc32_d_calc(uint8_t *data, uint32_t length)                                                  \n"
"{                                                                                                      \n"
"    uint32_t tmp = 0;                                                                                  \n"
"    uint32_t crc = 0xffffffff;                // Initial value                                         \n"
"    while(length--)                                                                                    \n"
"    {                                                                                                  \n"
"        tmp =  (0x000000FF & crc) ^ (*data++);    // crc ^= *data; data++;                             \n"
"        crc = (crc >> 8) ^ crc32D_table[tmp&0xFF];                                                     \n"
"    }                                                                                                  \n"
"    return ~crc; // crc ^ 0xFFFFFFFF                                                                   \n"
"}                                                                                                      \n";
const char* crc32_q_string =
"static uint32_t crc32Q_table[256] = {};                                                                \n"
"                                                                                                       \n"
"void crc32_q_GenerateTable()                                                                           \n"
"{                                                                                                      \n"
"    uint32_t crc = 0;                                                                                  \n"
"    for(uint16_t i=0; i<256; i++){                                                                     \n"
"        crc = i<<24;               // Initial value                                                     \n"
"        for (uint16_t j = 0; j < 8; ++j){                                                               \n"
"            if (crc & 0x80000000)                                                                       \n"
"                crc = (crc << 1) ^ 0x814141AB;                                                          \n"
"            else                                                                                        \n"
"                crc = (crc << 1);                                                                       \n"
"        }                                                                                               \n"
"        crc32Q_table[i] = crc;                                                                          \n"
"    }                                                                                                   \n"
"}                                                                                                       \n"
"                                                                                                        \n"
"uint32_t crc32_q_calc(uint8_t *data, uint32_t length)                                                   \n"
"{                                                                                                       \n"
"    uint32_t tmp = 0;                                                                                   \n"
"    uint32_t crc = 0;                // Initial value                                                   \n"
"    while(length--)                                                                                     \n"
"    {                                                                                                   \n"
"        tmp = (crc >> 24) ^ (*data++);    // crc ^= *data; data++;                                      \n"
"        crc = (crc << 8) ^ crc32Q_table[tmp&0xFF];                                                      \n"
"    }                                                                                                   \n"
"    return crc; // crc                                                                                  \n"
"}\n";


#endif // CODESTRING_H
